<!-- {if $member_from eq 'seller'}-->
		{include file=member.header.html}
        <!--{else}-->
       {include file=buyer.header.html}
        <!--{/if}-->
<script type="text/javascript">
//注册表单验证
$(function(){
    $('#binding_form').validate({
        errorPlacement: function(error, element){
            $(element).next('.field_notice').hide();
            $(element).after(error);
        },
        success       : function(label){
            label.addClass('validate_right').text('OK!');
        },
        onkeyup: false,
        rules : {           
            old_email : {
                required : true,
                email    : true
            },
            new_email : {
                required : true,                
                email    : true,
                nequalTo :'#old_email'
            },
            captcha : {
                required : true,
                remote   : {
                    url : 'index.php?app=captcha&act=check_captcha',
                    type: 'get',
                    data:{
                        captcha : function(){
                            return $('#captcha1').val();
                        }
                    }
                }
            }          
        },
        messages : {
            old_email : {
                required : '您必须提供您的电子邮箱',
                email    : '这不是一个有效的电子邮箱'
            },
            new_email : {
                required : '您必须提供您的电子邮箱',
                email    : '这不是一个有效的电子邮箱',
                nequalTo    : '新邮箱不能与旧邮箱相同'
            },
            captcha : {
                required : '验证码不能为空',
                remote   : '验证码不正确'
            }                     
        }
    });
    
    $("#old_email").blur(function(){
        var old_email = $("#old_email").val();      
        if(old_email && userValidate.chackEmail(old_email))
        {
            $.ajax({
            url:'index.php?app=send_email&act=chack_email',
            async:false,
            type:"post",
            dataType:"json",
            data:'email='+old_email,
            success:function(data){
                if(data.statu){
                    $('#old_email').attr("disabled", true);
                    $('#email').attr("disabled", false);
                    $('#send_submit').attr("disabled", false);
                    $("#show_error").hide().html('');
                    return;
                }else{
                   $("#show_error").show().html(data.msg);
                   $("#old_email").next("label").html('');
                   return;
                }
            }
          });

        }
        else
        {
            $('#email').attr("disabled", true);
            $('#send_submit').attr("disabled", true);
        }
  });
  $("#send_submit").click(function(){
        var email = $("#email").val();
        var captcha = $('#captcha1').val();
        var is_captcha = false;
        var old_email = $("#old_email").val();
        if(old_email == email)
        {
          alert('新邮箱不能与原邮箱相同');
            return;  
        }
        
        if(captcha==''){
            alert('验证码不能为空'); 
            return;        
        }
        $.ajax({
            url:'index.php?app=captcha&act=check_captcha',
            async:false,
            type:"get",
            dataType:"json",
            data:'captcha='+captcha,
            success:function(data){
                if(!data){
                    alert('验证码不正确');
                    is_captcha = true ; 
                }
  
            }
          });
        if(is_captcha){return;}       
        if(email && userValidate.chackEmail(email))
        {
           userValidate.sendEmail(email,'edit_binging_email');
           return;

        }
  });
  
});
</script>
<!-- 内容 -->
<div class="content f-cb">
  <!-- 当前位置 -->
  {include file=path.html}
  <!-- 内容左边栏 -->
  <!-- {if $member_from eq 'seller'}-->
  {include file=member.menu.html}
  <!--{else}-->
  {include file=member.menu.buyer.html}
  <!--{/if}-->
  <!-- 内容右边栏 -->
  <div class="right_content">
    <div class="t_1">修改绑定邮箱</div>
  </div>
  <div class="con-receive-r b-radius safety_content">
    <div class="eject_con">
      <div class="add safety_modify_password f-cb">
        <div class="binding_modify_form">
          <form method="post"  action="" id="binding_form">
            <ul>
              <li>
                <h3>原邮箱: </h3>
                <p>
                  <input type="text" class="text width_normal b-radius" name="old_email" id="old_email" /><em id="show_error"></em>
                </p>
              </li>
              <li>
                <h3>新邮箱: </h3>
                <p>
                  <input type="text" class="text width_normal b-radius" name="new_email" id="email" disabled="disabled" />
                </p>
              </li>
              <li>
              <h3>验证码: </h3>
              <p>
              <input type="text" name="captcha" class="text width2 b-radius" id="captcha1">
                &nbsp;&nbsp;
                <a href="javascript:change_captcha($('#captcha'));" class="renewedly" title="点击换一张"><img alt="点击换一张" id="captcha" src="index.php?app=captcha&amp;{$random_number}"></a>
              </p>
            </li>
            </ul>
            <div class="submit submit_1">
              <input type="button" class="subbtn b-radius" value="发送验证链接" disabled="disabled"  id="send_submit" />
              <br/>
              <br/>
              <a style="display:none;" href="http://mail.qq.com" target="_blank" class="linkbtn" id="gotoemail">验证邮件已发送！前往查看</a> </div>
          </form>
        </div>
        <div class="safety_prompt">
          <p><span class="f-fs2 f-fwb">邮箱能正常使用但收不到验证码怎么办？</span><br/>
            若您的邮箱能正常使用但无法接收到验证码邮件，请仔细查找垃圾箱邮件。同时由于网络原因，可能会有延迟。如果您10分钟还没有收到邮件，请重新发送。</p>
          <br/>
          <p><span class="f-fs2 f-fwb">无法通过验证？</span><br/>
            您可以通过人工寻求帮助。<br/>
            万菱客服：400-668-8038</p>
        </div>
      </div>
    </div>
  </div>
</div>
<!-- 页脚 -->
{include file=footer.html}